<template>
    <div class="searchcontainer">
        <input type="text" v-model="keyWord" />
        <button @click="search">Search</button>
    </div>
</template>

<script>
    import eventBus from '@/eventBus.js'
    export default {
        name:'Search',
        data(){
            return {
                keyWord:'',
            }
        },
        methods:{
            search(){
                this.$axios.get(`https://api.github.com/search/users?q=${this.keyWord}`).then(res => {
                    // 将数据给兄弟组件
                    eventBus.$emit("list",res.data.items);
                })
            }
        }
    }
</script>

<style scoped>


</style>